package cn;
import cn.webrx.App;
import cn.webrx.Book;
import cn.webrx.BookRepository;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;
import java.time.LocalDate;
/**
 * <p>功能描述: </p>
 *
 * @author webrx
 * @version 1.0
 * @date 2020-05-23 16:46
 */
@RunWith(SpringRunner.class)
@SpringBootTest(classes = App.class)
public class Demo {
    @Autowired
    private BookRepository bookdao;

    @Test
    public void all(){
        System.out.println(bookdao.findAll());
    }
    @Test
    public void crud(){
        Book book = new Book();
        book.setName("《PHP入门开发》");
        book.setPdate(LocalDate.of(2020,3,20));
        book.setPrice(28);
        bookdao.save(book);
        Book b = bookdao.findById(2).get();
        System.out.println(b);
    }

    @Test
    public void show() {
        System.out.println("test.");
    }
}
